﻿@model IFDB.Models.Tables.AppearanceEvent

@switch (Model.MatchEventType)
{
    case IFDB.ResourceLibrary.MatchEventType.Substitution:
        <img style="vertical-align: middle; height: 15px" src="~/Content/images/substitution.png" alt="Substitution @GetMinutesDisplay(@Model.Minute, @Model.Plus)" title="On as substitute @GetMinutesDisplay(@Model.Minute, @Model.Plus)" />
        break;
        
    case IFDB.ResourceLibrary.MatchEventType.Goal:
        <img style="vertical-align: middle; height: 15px" src="~/Content/images/goal.png" alt="Goal @GetMinutesDisplay(@Model.Minute, @Model.Plus)" title="Goal @GetMinutesDisplay(@Model.Minute, @Model.Plus)" />
        break;
        
    case IFDB.ResourceLibrary.MatchEventType.OwnGoal:
        <img style="vertical-align: middle; height: 15px" src="~/Content/images/owngoal.png" alt="Own goal @GetMinutesDisplay(@Model.Minute, @Model.Plus)" title="Own goal @GetMinutesDisplay(@Model.Minute, @Model.Plus)" />
        break;
        
    case IFDB.ResourceLibrary.MatchEventType.YellowCard:
        <img style="vertical-align: middle; height: 15px" src="~/Content/images/yellowcard.png" alt="Yellow card @GetMinutesDisplay(@Model.Minute, @Model.Plus)" title="Yellow card @GetMinutesDisplay(@Model.Minute, @Model.Plus)" />    
        break;
        
    case IFDB.ResourceLibrary.MatchEventType.RedCard:
        <img style="vertical-align: middle; height: 15px" src="~/Content/images/redcard.png" alt="Red card @GetMinutesDisplay(@Model.Minute, @Model.Plus)" title="Red card @GetMinutesDisplay(@Model.Minute, @Model.Plus)" />    
        break;
}

@functions
{
    private string GetMinutesDisplay(int? minute, int? plus)
    {
        if (minute == null)
            return string.Empty;

        if (plus == null)
            return string.Format("({0} minutes)", minute.ToString());

        return string.Format("({0} + {1} minutes)", minute.ToString(), plus.ToString());
    }
}